package com.zkh.myframe.database.mapper.tag;

import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;

/**
 * foreach标签
 * @author zkh
 */
public class Foreach extends Tag {
	/*属性值*/
	private String collection;
	private String item = "item";
	private String index = "index";
	private String open = "";
	private String close = "";
	private String separator;
	
	/**
	 * 渲染属性
	 */
	public void renderAttribute(NamedNodeMap attrs) {
		//临时节点
		Node node = null;
		if((node=attrs.getNamedItem("collection"))!=null)setCollection(node.getNodeValue());
		if((node=attrs.getNamedItem("item"))!=null)setItem(node.getNodeValue());
		if((node=attrs.getNamedItem("open"))!=null)setOpen(node.getNodeValue());
		if((node=attrs.getNamedItem("close"))!=null)setClose(node.getNodeValue());
		if((node=attrs.getNamedItem("separator"))!=null)setSeparator(node.getNodeValue());
	}
	
	public String getCollection() {
		return collection;
	}
	public void setCollection(String collection) {
		this.collection = collection;
	}
	public String getItem() {
		return item;
	}
	public void setItem(String item) {
		this.item = item;
	}
	public String getIndex() {
		return index;
	}
	public void setIndex(String index) {
		this.index = index;
	}
	public String getOpen() {
		return open;
	}
	public void setOpen(String open) {
		this.open = open;
	}
	public String getClose() {
		return close;
	}
	public void setClose(String close) {
		this.close = close;
	}
	public String getSeparator() {
		return separator;
	}
	public void setSeparator(String separator) {
		this.separator = separator;
	}
}
